package com.x.erp.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.alibaba.dubbo.config.annotation.Service;
import com.x.erp.dao.CarLocationDao;
import com.x.erp.model.CarLocation;
import com.x.erp.rpc.CarLocationRpcService;
import com.x.framework.exception.BusinessException;
import com.x.framework.exception.ExceptionCode;
import com.x.framework.service.BaseService;

/**
 * 车牌所在地服务
 */
@Component
@Service(interfaceName = "com.x.erp.rpc.CarLocationRpcService", timeout = 60000)
public class CarLocationService extends BaseService implements CarLocationRpcService {

	@Autowired
	private CarLocationDao carLocationDao;//车牌所在地信息DAO

	/**
	 * 查询车牌所在地列表
	 * @param carLocation
	 * @return
	 */
	@Override
	public List<CarLocation> selectCarLocationList(CarLocation carLocation){
		try {
			return carLocationDao.selectCarLocationList(carLocation);
		} catch (Exception e) {
			throw new BusinessException(ExceptionCode.EXCEPTION_CODE0000, e);
		}
	}

	/**
	 * 查询车牌所在地数量
	 * @param carLocation
	 * @return
	 */
	@Override
	public int selectCarLocationNum(CarLocation carLocation){
		try {
			return carLocationDao.selectCarLocationNum(carLocation);
		} catch (Exception e) {
			throw new BusinessException(ExceptionCode.EXCEPTION_CODE0000, e);
		}
	}

	/**
	 * 新增车牌所在地信息
	 * @param carLocation
	 * @return
	 */
	@Override
	public CarLocation insertCarLocation(CarLocation carLocation){
		try {
			return this.insert(carLocation);
		} catch (Exception e) {
			throw new BusinessException(ExceptionCode.EXCEPTION_CODE0000, e);
		}
	}

	/**
	 * 修改车牌所在地信息
	 * @param carLocation
	 * @return
	 */
	@Override
	public int updateCarLocation(CarLocation carLocation){
		return this.update(carLocation);
	}

}
